package sum.book.common.core.model.dto;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;


@Data
@NoArgsConstructor
public class DataDTO<T>  implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 数据集合
     */
    private T list;

    /**
     * 分页信息
     */
    private PageDTO pagination;

    public DataDTO(T list, IPage page){
        this.setList(list);
        this.setPagination(new PageDTO(page.getTotal(), page.getSize(), page.getCurrent()));
    }
}
